<script setup lang="ts">
import {ref,watch} from 'vue';
let text= ref("")
const jinci=["你","我","他"]
watch(()=>text.value,(newValue,oldValue)=>{
jinci.forEach(s=>{
  if(newValue.includes(s)){
        let newtext=newValue.substring(0,newValue.length-1);
      
        text.value=newtext;
        alert("勿作死");
    }
})
    
    
  
  })
  </script>

<template>
  <div>
    <input type="text" placeholder="请输入，不能有‘我’" v-model="text" />
</div>
</template>

<style scoped></style>
